import React, { Component } from 'react';
import axios from 'axios';
class Com extends Component {
  constructor (props) {
    super(props)
    this.state = {
      collectlist:[]
    }
  }

  componentDidMount () {
    // console.log(this.props);
      axios.get(`http://poem.daxunxun.com:8000/api/collect/searchUid?uid=1`,{dataType:'json'})
        .then((res) => {
          // console.log(res.data)
          let arr =[];
          for(let i in res.data){
            arr.push(res.data[i].sid)
          }
          var set = new Set(arr);
          var arrsid = [...set];
          // this.setState({
          //   list:arrsid
          // })
          for(var item of arrsid){
            // console.log(item);
            axios.get(`http://poem.daxunxun.com:8000/api/juzi/searchSid?sid=${item}`,{dataType:'json'})
              .then((res)=>{
                var collectlist=[];
                // console.log(res.data[0]);
                collectlist.push(res.data[0]);
                this.setState({
                  collectlist:collectlist
                })
              })
          }
        })    
  }
  render () {
    // console.log(this.state.collectlist);
    return (
      <div className="collectsearchmiddle">
        还没有收藏,快去收藏吧！
      </div>
    )
  }
}

export default Com;
